Add simple asset autoloop#886
Merged
sputn1ck merged 11 commits intolightninglabs:masterfrom Mar 25, 2025
Merged
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a simple asset autoloop mode by reusing the easy autoloop runloop.
Testing instructions:
In order to test you need a docker-regtest setup with an asset channel.
EDIT(hieblmi) Setup with an asset channel with following steps:
Afterwards set up your loop with the extra flags:
You then need to activate your asset autoloop with
Then you can run
./loop-debug forceautoloopthis should dispatch a loop outAI generated summary:
This pull request introduces significant changes to the
assets/client.goandliquidity/liquidity.gofiles, adding new functionality for handling asset prices and improving the overall asset management. The most important changes include the addition of a new method to get asset prices, modifications to the client configuration to include an asset client, and updates to the liquidity manager to support easy autoloop functionality for assets.Asset Management Enhancements:
assets/client.go: Added a new methodGetAssetPriceto retrieve the price of an asset in satoshis using the RFQ process. Also, added a helper functiongetSatsFromAssetAmtto convert asset amounts to satoshis.assets/client_test.go: Added tests for the newgetSatsFromAssetAmtfunction to ensure correct conversion of asset amounts to satoshis.Client Configuration Updates:
client.go: Updated theClientstruct and related methods to useAssetClientinstead ofassetClient, ensuring consistency and proper initialization. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]config.go: AddedAssetClientto theclientConfigstruct to support asset-related operations.Liquidity Manager Enhancements:
liquidity/liquidity.go: Introduced new functionality for easy autoloop operations for assets, including methods to handle asset prices and dispatch swaps based on asset balances. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]These changes collectively enhance the system's ability to manage and utilize assets more effectively, providing better support for asset-related operations and improving the overall functionality of the liquidity manager.